package com.campus.counseling.model.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.campus.counseling.entity.ChatMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ChatMessageMapper extends BaseMapper<ChatMessage> {
    
    List<ChatMessage> selectByAppointmentId(@Param("appointmentId") Long appointmentId);
    
    int countUnread(@Param("userId") Long userId, @Param("appointmentId") Long appointmentId);
    
    void updateStatusToRead(@Param("userId") Long userId, @Param("appointmentId") Long appointmentId);

    ChatMessage selectById(@Param("id") Long id);
} 